<template>
	<view :class="activity.config.style">
		<view class="search">
			<view class="uni-form-item uni-column">
				<uni-icons type="search" size="18" class="search-icon"></uni-icons>
				<input class="uni-input search-input" confirm-type="search" placeholder="搜索商品" @confirm="startSearch"/>
			</view>
		</view>
	</view>
</template>

<script>
	import Base from '@/muu_activity/common/base.vue'
	export default {
		extends:Base,
		data() {
			return {
				loading: true, //加载中
			}
		},
		async onLoad(option) { //option为object类型，会序列化上个页面传递的参数
			await this.$onLaunched
			await this.baseIsReady()
		},
		methods: {
			
			/**
			 * 执行搜索
			 * @param {Object} e
			 */
			startSearch: function(e){
				console.log(e)
				let keyword = e.detail.value
				
				let url = '../activity/lists?keyword=' + keyword
				//指定跳转地址
				uni.navigateTo({
				    url: url
				});
			}
		}
	}
</script>

<style lang="scss">
	.search {
		position: relative;
		padding: 10rpx 20rpx;
		.search-input {
			border: 2rpx solid #fff;
			background-color: #f2f2f2;
			border-radius: 30rpx;
			padding: 12rpx 12rpx 12rpx 60rpx;
			font-size: 28rpx;
		}
		.search-icon {
			position: absolute;
			left: 36rpx;
			top: 24rpx;
			color: #000;
		}
	}
</style>
